import java.util.Scanner;

public class a147_Print_it_all {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n;
		
		String output;
		
		while(sc.hasNext()) {
			n = sc.nextInt();
			if(n == 0)
				return;
			
			output = "";
			for(int i = 1; i < n; i++) {
				if(i % 7 != 0)
					output += Integer.toString(i) +" ";
			}
			
			if(output.length() > 1)
				output = output.substring(0, output.length() - 1);
			
			System.out.println(output);
		} // next
	} // main
	
}